package com.rc.saas.tenant.common.enums;


/**
 * Create by Yang on 2021/10/14
 * <p>
 * 序号结束原因描述备注
 * 0上位机/正常停止
 * 1急停按钮动作故障
 * 2烟感故障
 * 3交流断路器故障
 * 4直流母线输出接触器故障
 * 5直流母线输出熔断器故障
 * 6充电接口电子锁故障
 * 7充电机风扇故障
 * 8避雷器故障
 * 9绝缘检测故障
 * 10电池反接故障
 * 11充电中车辆控制导引故障
 * 12充电桩过温故障
 * 13充电接口过温故障
 * 14充电枪未归位告警
 * 15BMS通讯故障
 * 16交流输入过压故障
 * 17交流输入欠压故障
 * 18直流母线输出过压故障
 * 19直流母线输出欠压故障
 * 20直流母线输出过流故障
 * 21充电模块故障
 * 22充电模块交流输入告警
 * 23充电模块输入过压告警
 * 24充电模块输入欠压告警
 * 25充电模块输入缺相告警
 * 26充电模块输出短路告警
 * 27充电模块输出过流告警
 * 28充电模块输出过压告警
 * 29充电模块输出欠压告警
 * 30充电模块过温故障
 * 31充电模块通讯告警
 * 32充电模块风扇告警
 * 33门禁故障
 * 34直流输出接触器粘连故障
 * 35绝缘监测告警
 * 36泄放回路故障
 * 37充电桩过温告警
 * 38充电枪过温告警
 * 39交流输入接触器据动/误动故障
 * 40交流输入接触器粘连故障
 * 41辅助电源故障
 * 42并联接触器据动/误动故障
 * 43并联接触器粘连故障
 * 44充电模块通讯故障
 * 101外配温度传感器失效告警
 * 102绝缘检测单元通讯故障
 * 103电能表通讯故障
 * 104IC刷卡器通讯告警
 * 105跟上位机通讯故障
 * 106跟TMU通讯故障
 * 107内部存储器写入错误告警
 * 200电池最高允许充电电压小于充电机最小输出电压
 * 201绝缘监测前直流输出接触器外侧电压≥10 V
 * 202启动充电前直流输出接触器外侧电压与通信报文电池电压相差＞±5%
 * 203启动充电前直流输出接触器外侧电压小于充电机最小输出电压
 * 204启动充电前直流输出接触器外侧电压大于充电机最大输出电压
 * 205电池端电压大于电池最高允许充电电压
 * 206BRM 报文接收超时
 * 207BRM 报文数据项异常
 * 208BCP 报文接收超时
 * 209BCP 报文数据项异常
 * 210BRO 报文（0x00）接收超时
 * 211BRO 报文（0xAA）接收超时
 * 212电池充电需求报文（BCL）超时
 * 213电池充电总状态报文（BCS）超时
 * 214动力蓄电池状态信息（BSM）超时
 * 215BSM 报文中单体动力蓄电池电压过压
 * 216BSM 报文中单体动力蓄电池电压过低
 * 217BSM 报文中SOC 过高
 * 218BSM 报文中SOC 过低
 * 219BSM 报文中充电过电流
 * 220BSM 报文中动力蓄电池温度过高
 * 221BSM 报文中动力蓄电池绝缘状态异常
 * 222BSM 报文中连接器连接状态异常
 * 223CTR判定单体电池电压过高
 * 224CTR判定单体电池温度过高
 * 225BMS异常终止充电
 * 226充电桩判断BMS其他异常终止
 * 227电池最高允许充电电流小于充电机最小输出电流
 * 228充电过程中BMS采样电压与充电机采样电压偏差大超过10分钟
 * 229预充电1分钟内没有达到完成条件
 * 230充电暂停超过10分钟
 * 231充电过程中BMS采样电压与充电机采样电流偏差大超过10分钟
 * 232BMS需求电压<最小输出电压
 * 233BMS需求电流<最小输出电流
 * 244TCU的启动完成帧应答超时
 * 248BST停止-达到SOC目标值正常结束
 * 249BST停止-达到SOC目标值不可信正常结束
 * 251BMS正常结束正常结束
 * 252BMS故障停止充电
 * 253BMS错误停止充电
 * 254BST停止-达到总电压设定值正常结束
 * 255BST停止-达到总电压设定值不可信正常结束
 * 256BST停止-达到单体电压设定值正常结束
 * 257BST停止-达到单体电压设定值不可信正常结束
 * 258BST停止-充电机中止正常结束
 * 259BST停止-充电机中止不可信正常结束
 * 260BST停止-绝缘故障
 * 261BST停止-绝缘不可信
 * 262BST停止-输出连接器过温
 * 263BST停止-输出连接器过温不可信
 * 264BST停止-BMS元件输出连接器过温
 * 265BST停止-BMS元件输出连接器过温不可信
 * 266BST停止-充电连接器故障
 * 267BST停止-充电连接器故障不可信
 * 268BST停止-电池组温度过高
 * 269BST停止-电池组温度过高不可信
 * 270BST停止-高压继电器故障
 * 271BST停止-高压继电器故障不可信
 * 272BST停止-检测点２电压检测故障
 * 273BST停止-检测点２电压检测故障不可信
 * 274BST停止-其它故障
 * 275BST停止-其它故障不可信
 * 276BST停止-其它故障原因
 * 277BST停止-电流过大
 * 278BST停止-电流过大不可信
 * 279BST停止-电压异常
 * 280BST停止-电压异常不可信
 * 281BST停止-其它错误原因
 * 1000TMU主动停止
 * 1001达到预充条件
 * 1002APP远程停止正常结束
 * 1003功率单元通讯故障
 * 1004功率单元IO故障
 * 1005启动超时停止
 * 1006电表读数异常
 * 1007无费率停止充电
 * 1008小电流正常停机正常结束
 * 1009断网停机
 * 1010刷卡停机正常结束
 * 1011App模式密码停机正常结束
 * 1012IC卡模式密码停机正常结束
 * 1013达到本地设置的禁充条件停机(预设电流、SOC) 正常结束
 * 1014设置SOC提前量终止正常结束
 * 1015TCU返回状态异常
 * 1016VIN启动密码停机正常结束
 * 1017VIN不匹配停机
 * 1018账号密码停机正常结束
 * 1019达到电量停机正常结束
 * 1020达到金额停机正常结束
 * 1021达到时间停机正常结束
 * 1022账户金额不足正常结束
 * 1023达到服务器预设SOC停止正常结束
 * 1024服务器判断余额不足停机正常结束
 * <p>
 * <p>
 * *****************************************************************************
 * 交流桩结束代码定义: 备注栏为 正常结束的项为非故障停止,平台统计时注意区分
 * 序号结束原因描述备注
 * 2001充电中控制导引故障
 * 2002急停按钮动作故障
 * 2003门禁故障
 * 2004避雷器故障
 * 2005烟感故障
 * 2006交流输入断路器故障
 * 2007PE断线故障
 * 2008水浸故障
 * 2009充电桩过温故障
 * 2010充电接口过温故障
 * 2011充电接口电子锁故障
 * 2012交流输出接触器拒动/误动故障
 * 2013交流输出接触器粘连故障
 * 2014交流输入电压过压故障
 * 2015交流输入电压欠压故障
 * 2016交流输入电压缺相故障
 * 2017交流输入过流故障
 * 2018交流输出电压过压故障
 * 2019交流输出电压欠压故障
 * 2020交流输出电压过流故障
 * 2021交流输出电压短路故障
 * 2022充电控制器与计费单元通讯中断
 * 2023电表通信故障
 * 2024读卡器通讯故障
 * 2025通讯模块故障
 * 2026SIM卡异常
 * 2027断电上传异常结束
 * 2028预留
 * 2029预留
 * 3001APP远程停止正常结束
 * 3002启动超时停止
 * 3003电表读数异常
 * 3004无费率停止充电
 * 3005小电流正常停机正常结束
 * 3006断网停机
 * 3007刷卡停机正常结束
 * 3008App模式密码停机正常结束
 * 3009IC卡模式密码停机正常结束
 * 3010达到本地设置的禁充条件停机(预设电流) 正常结束
 * 3011账号密码停机正常结束
 * 3012达到电量停机正常结束
 * 3013达到金额停机正常结束
 * 3014达到时间停机正常结束
 * 3015账户金额不足正常结束
 */
public enum YlStopReasonEnum {


    YlStopReason_0(0,"正常结束","BMS主动停机"),
    YlStopReason_1(1,"接收BMS的辨识报文超时时","充电机主动停止"),
    YlStopReason_2(2,"接收电池充电参数报文超时","充电机主动停止"),
    YlStopReason_3(3,"接收BMS完成充电准备报文超时","充电机主动停止"),
    YlStopReason_4(4,"接收电池充总状态报文超时","充电机主动停止"),
    YlStopReason_5(5,"接收电池充电需求报文超时","充电机主动停止"),
    YlStopReason_6(6,"接收BMS中止充电报文超时","充电机主动停止"),
    YlStopReason_7(7,"接收BMS充电统计报文超时","充电机主动停止"),
    YlStopReason_20(20,"收到bst报文停止","BMS报文错误，充电机主动停止"),
    YlStopReason_21(21,"收到BSM报文错误停止","BMS主动停止BMS发送BSM状态有误，充"),
    YlStopReason_22(22,"bms电池达到设定温度","电机主动停止"),
    YlStopReason_23(23,"单体电压过高异常","BMS报文的当前温度比BMS发送的最高允许温度高或超过人工设定值（目前默认是100度），充电机主动停止"),
    YlStopReason_24(24,"需求电流异常","BMS报文的当前温度比BMS发送的最高允许单体电压高或超过人工设定值（目前默认是6V),充电机主动停止"),
    YlStopReason_25(25,"BST的SOC目标值","需求电流是负数，充电机主动停止"),
    YlStopReason_30(30,"BST的电压设定值","BMS发出BST报文,BMS主动停止"),
    YlStopReason_31(31,"BST单体电压满","BMS发出BST报"),
    YlStopReason_32(32,"BST_00_6","BMS发出BST报"),
    YlStopReason_33(33,"BST绝缘故障","BMS主动停止"),
    YlStopReason_34(34,"BST连接器过温","BMS发出BST报文，BMS主动停止"),
    YlStopReason_35(35,"BST元件过温","BMS发出BST报文，BMS主动停止"),
    YlStopReason_36(36,"BST连接器故障","BMS发出BST报文，BMS主动停止"),
    YlStopReason_37(37,"BST电池组过温","BMS发出ST报文,BMS主动停止"),
    YlStopReason_38(38,"BST其他故障","BMS发出BST报文，BMS主动停止"),
    YlStopReason_39(39,"BST_02_4","BMS发出BST报文，BMS主动停止"),
    YlStopReason_40(40,"BST电压异常","BMS发出BST报文，BMS主动停止"),
    YlStopReason_43(43,"","BMS发出BST报文，BMS主动停止"),
    YlStopReason_200(200,"用户中止","用户操作停止，充电机主动停止"),
    YlStopReason_201(201,"系统告警1","控制板上报告警，充电机主动停止"),
    YlStopReason_202(202,"系统告警2","控制板上报告警，充电机主动停止"),
    YlStopReason_300(300,"CC1连接断开","CC1断开，充电机主动停止"),
    YlStopReason_301(301,"用户刷卡停止","用户刷卡停止，充电机主动停止"),
    YlStopReason_302(302,"紧急停机","用户操作紧急按钮，充电机主动停止"),
    YlStopReason_303(303,"预处理加电失败","充电卡锁定失败，充电机主动停止"),
    YlStopReason_304(304,"绝缘检测异常","充电机主动停止"),
    YlStopReason_305(305,"控制板通讯异常","充电机主动停止"),
    YlStopReason_306(306,"充电电量达到设定值","充电机主动停止"),
    YlStopReason_307(307,"充电时间达到设定值","充电机主动停止"),
    YlStopReason_308(308,"充电金额达到设定值","充电机主动停止"),
    YlStopReason_309(309,"电表通讯异常","充电机主动停止"),
    YlStopReason_310(310,"充电金额超过用户卡余额","充电机主动停止"),
    YlStopReason_311(311,"后台终止","收到后台关机指令，充电机主动停止控制板上报系统故"),
    YlStopReason_312(312,"系统告警中止","控制板上报系统故障，充电机主动停止"),
    YlStopReason_313(313,"后台通讯中止","集中器通讯断开，充电机主动停止"),
    YlStopReason_314(314,"充电电压异常中止","控制板上传充电电压比需求电压大，充电机主动停止"),
    YlStopReason_315(315,"充电电流异常中止","控制板上传充电电流比需求电流大，充电机主动停止"),
    YlStopReason_316(316,"BMS的SOC满中止","系统SOC达到设定值（默认100%)，充电机主动停止"),
    YlStopReason_317(317,"电表电量异常增大中止","电表电量突然持续异常跳变到较大的值，监控板和控制板都要判断"),
    YlStopReason_318(318,"电表电量异常变小中止","电表电量突然持续异常跳变到较小的值，监控板和控制板都要判断"),
    YlStopReason_319(319,"VIN码不匹配","车辆VIN码与设定的不匹配"),
    YlStopReason_401(401,"管理员界面中止",""),
    YlStopReason_402(402,"软件升级","系统软件进行升级，中止充电"),
    YlStopReason_403(403,"充电启动超时","启动充电时间60秒内没进入充电阶段"),
    YlStopReason_404(404,"BMS单体动力蓄电池电压异常",""),
    YlStopReason_405(405,"BMS整车动力蓄电池荷电状态","系统突然断电，充电机主动停止"),
    YlStopReason_406(406,"BMS动力蓄电池充电过电流",""),
    YlStopReason_407(407,"BMS动力蓄电池温度过高",""),
    YlStopReason_408(408,"BMS动力蓄电池绝缘状态",""),
    YlStopReason_409(409,"BMS蓄电池组输出连接器状态",""),
    YlStopReason_410(410,"充电电压超过BMS最大允许值",""),
    YlStopReason_411(411,"BMS其他位状态异常",""),
    YlStopReason_412(412,"BCS上传电压异常",""),
    YlStopReason_2000(2000,"系统其他故障",""),
    YlStopReason_2001(2001,"紧急停机故障",""),
    YlStopReason_2002(2002,"绝缘故障",""),
    YlStopReason_2003(2003,"直流过压",""),
    YlStopReason_2004(2004,"直流欠压",""),
    YlStopReason_2005(2005,"软启失败",""),
    YlStopReason_2006(2006,"输出反接故障",""),
    YlStopReason_2007(2007,"接触器异常",""),
    YlStopReason_2008(2008,"模块故障",""),
    YlStopReason_2009(2009,"电网电压高",""),
    YlStopReason_2010(2010,"电网电压低",""),
    YlStopReason_2011(2011,"电网频率高",""),
    YlStopReason_2012(2012,"电网频率低",""),
    YlStopReason_2013(2013,"模块通信异常",""),
    YlStopReason_2014(2014,"模块类型不一致",""),
    YlStopReason_2015(2015,"系统辅源掉电",""),
    YlStopReason_2016(2016,"直流输出断路",""),
    YlStopReason_2017(2017,"进风口过温保护",""),
    YlStopReason_2018(2018,"进风口低温保护",""),
    YlStopReason_2019(2019,"出风口过温保护",""),
    YlStopReason_2020(2020,"群充模块过温",""),
    YlStopReason_2021(2021,"防雷故障",""),
    YlStopReason_2022(2022,"交流接触器异常",""),
    YlStopReason_100001(100001,"100000以上故障为迪文通信告警",""),
    YlStopReason_100002(100002,"读卡器通信告警",""),
    YlStopReason_100003(100003,"防雷器故障",""),
    YlStopReason_100004(100004,"主开关及熔断器故障",""),
    YlStopReason_100005(100005,"紧急停机故障",""),
    YlStopReason_100032(100032,"电表1通信异常",""),
    YlStopReason_100033(100033,"电表2通信异常",""),
    YlStopReason_101000(101000,"断开连接",""),
    YlStopReason_101001(101001,"未准备就绪",""),
    YlStopReason_101002(101002,"充电过压",""),
    YlStopReason_101003(101003,"充电过流",""),
    YlStopReason_101004(101004,"充电欠压",""),
    YlStopReason_101005(101005,"用户刷卡停止充电",""),
    YlStopReason_101006(101006,"后台停止",""),
    YlStopReason_101007(101007,"充电时间达到设定值","充电机主动停止"),
    YlStopReason_101008(101008,"充电金额达到设定值","充电机主动停止"),
    YlStopReason_101009(101009,"充电电量达到设定值","充电机主动停止"),
    YlStopReason_101010(101010,"应用软件升级停止",""),
    YlStopReason_101011(101011,"系统掉电停止",""),
    YlStopReason_101012(101012,"未知原因",""),
    YlStopReason_101013(101013,"用户界面中止",""),
    YlStopReason_101014(101014,"金额不足",""),
    YlStopReason_101015(101015,"电池充满",""),
    YlStopReason_101016(101016,"达到用户设定充电条件停止",""),
    ;


    private Integer code;

    private String msg;

    private String detail;


    /**
     * 解析code
     *
     * @param code
     * @return
     */
    //public static String getStopReasonMsg(String code) {
    //    Integer intCode = Integer.parseInt(code, 16);
    //    int integer = Integer.valueOf(intCode);
    //    Class<YlStopReasonEnum> ylStopReasonEnumClass = YlStopReasonEnum.class;
    //    for (YlStopReasonEnum enumConstant : ylStopReasonEnumClass.getEnumConstants()) {
    //        if (enumConstant.getCode() == integer) {
    //            return enumConstant.getMsg();
    //        }
    //    }
    //    return "未知故障码code:" + code;
    //}



    public static String getStopReasonMsg(Integer code) {
        //Integer intCode = Integer.parseInt(code, 16);
        //int integer = Integer.valueOf(intCode);
        Class<YlStopReasonEnum> ylStopReasonEnumClass = YlStopReasonEnum.class;
        for (YlStopReasonEnum enumConstant : ylStopReasonEnumClass.getEnumConstants()) {
            if (enumConstant.getCode().intValue() == code.intValue()) {
                return enumConstant.getMsg();
            }
        }
        return "未知故障码code:" + code;
    }

    public Integer getCode() {
        return code;
    }

    YlStopReasonEnum(Integer code, String msg,String detail) {
        this.code = code;
        this.msg = msg;
        this.detail = detail;
    }

    public void setCode(Integer code) {
        this.code = code;
    }


    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }
}
